from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.substitutions import FindPackageShare
from launch.substitutions import PathJoinSubstitution


def generate_launch_description():
    # 包含另一个包的 launch 文件
    other_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            [
                # 拼接路径，找到要包含的 launch 文件
                PathJoinSubstitution(
                    [
                        FindPackageShare("1_python_base"),  # 替换为你要包含的包名
                        "2_topic_public_subscriber.launch.py",  # 替换为目标 launch 文件名
                    ]
                )
            ]
        ),
        # 可选：传递参数给被包含的 launch 文件
        launch_arguments={"arg1": "value1", "arg2": "value2"}.items(),
    )

    return LaunchDescription([other_launch])
